import request from '../../utils/request';

// FAQ 管理相关 API

// 创建FAQ
export const createFaq = (data: any) => {
    return request({
        url: '/system/api/faq',
        method: 'post',
        data
    });
};

// 更新FAQ
export const updateFaq = (id: string, data: any) => {
    return request({
        url: `/system/api/faq/${id}`,
        method: 'put',
        data
    });
};

// 更新FAQ状态
export const updateFaqStatus = (id: string, status: number) => {
    return request({
        url: `/system/api/faq/${id}/status/${status}`,
        method: 'put'
    });
};

// 分页查询FAQ
export const getFaqPage = (params: any) => {
    return request({
        url: '/system/api/faq/page',
        method: 'get',
        params
    });
};

// 获取FAQ列表
export const getFaqList = () => {
    return request({
        url: '/system/api/faq/list',
        method: 'get'
    });
};

// 根据语言获取启用的FAQ
export const getEnabledFaqByLanguage = (language: string) => {
    return request({
        url: `/system/api/faq/enabled/${language}`,
        method: 'get'
    });
};

// 根据ID获取FAQ
export const getFaqById = (id: string) => {
    return request({
        url: `/system/api/faq/${id}`,
        method: 'get'
    });
};

// 删除FAQ
export const deleteFaq = (id: string) => {
    return request({
        url: `/system/api/faq/${id}`,
        method: 'delete'
    });
};

// 批量操作FAQ
export const batchFaq = (data: any) => {
    return request({
        url: '/system/api/faq/batch',
        method: 'post',
        data
    });
};
